package com.core.redis.publisher;


import org.apache.log4j.Logger;

import redis.clients.jedis.Jedis;

import com.core.redis.util.RedisPubCluster;

public class MyPublisher {

	private static Logger logger = Logger.getLogger(MyPublisher.class);
	
	public void publish(){
		
		// 获得推送的jedis connect，因为发布、订阅要使用不同的redis客户端
		Jedis jedis = RedisPubCluster.getInCluster().getJedis();
		
		String message = "success"+System.currentTimeMillis();
		
		logger.info("----------publish:"+message);
		
		jedis.publish("test", message);
	}
	
	public static void main(String[] args) {
		MyPublisher pub = new MyPublisher();
		pub.publish();
	}
	
}
